package com.listener;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import com.MySessionContext;

public class LoginSessionListener implements HttpSessionListener {
	//public static Map<Object,Object> userMap = new HashMap<Object,Object>();可以不用写
	private MySessionContext myc = MySessionContext.getInstance();

	@Override
	public void sessionCreated(HttpSessionEvent event) {
		myc.addSession(event.getSession());
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent event) {
		HttpSession session = event.getSession();
		myc.delSession(session);
	}

}
